package Coding.IO;
/**
 * OOS  对象序列化 把对象存储到文件中的过程
 */

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class ObjectStream {



    public static void main(String[] args) throws IOException {
        String name = "XiaoYU";
        int age =18;
        String gender = "nan";
        String[] other = {"s","o"};
        Person person = new Person(name, age, gender, other);
        System.out.println(person);

        FileOutputStream fos = new FileOutputStream("./demo.txt");
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(fos);

        objectOutputStream.writeObject(person);
        System.out.println("写出完毕");
        objectOutputStream.close();


    }
}
